{extend name="base/base" /}
{block name="style"}
<style type="text/css">

</style>
{/block}
{block name="content"}
  <div class="layui-form-item layui-form-pane">
    <div class="layui-inline">
            <label class="layui-form-label">智能云</label>
            <div class="layui-input-inline">
              <select class="layui-input" name='config_id' id='config_id'>
                <option value="">全部</option>
                {foreach $robot as $val}
                  <option value="{$val.id}">{$val.name}</option>
                {/foreach}
              </select>
            </div>
    </div>
      <!-- <div class="layui-inline">
        <label class="layui-form-label">买入币种</label>
        <div class="layui-input-inline">
          <select class="layui-input" name='wid' id='wid'>
            <option value="">全部</option>
            <option value="10">KY</option>
            <option value="1">USDT</option>
          </select>
        </div>
      </div> -->
      <!-- <div class="layui-inline">
          <label class="layui-form-label">用户ID</label>
          <div class="layui-input-inline">
              <input type="text" name="uid" autocomplete="off" class="layui-input" id='uid'>
          </div>
      </div>
      <div class="layui-inline">
          <label class="layui-form-label">用户名</label>
          <div class="layui-input-inline">
              <input type="text" name="username" autocomplete="off" class="layui-input" id='username'>
          </div>
      </div>
    <div class="layui-inline">
          <label class="layui-form-label">下单时间</label>
          <div class="layui-input-inline">
              <input type="text" class="layui-input" name="start_time" id="start_time" placeholder="yyyy-MM-dd">
          </div>
          <div class="layui-form-mid">-</div>
          <div class="layui-input-inline">
              <input type="text" class="layui-input" name="end_time" id="end_time" placeholder="yyyy-MM-dd">
          </div>
      </div> -->
    <!--   <div class="layui-inline">
          <label class="layui-form-label">电话</label>
          <div class="layui-input-inline">
              <input type="text" name="phone" autocomplete="off" class="layui-input" id='phone'>
          </div>
      </div> -->
      <div class="layui-inline">
        <div class="demoTable">
          <button class="layui-btn" data-type="reload">搜索</button>
          <button class="layui-btn layui-btn-danger" onclick="add()">新增</button>
        </div>
      </div>
        <script type="text/html" id="edit">
    <!-- <a class="layui-btn layui-btn-xs" lay-event="edit">开启/关闭</a> -->

  </script>
  <table id="table" lay-filter="table"></table> 
</div>
{/block}
{block name="script"}
<script>
layui.use(['table', 'laydate'], function(){
  var table = layui.table;
  var laydate = layui.laydate;
  table.render({
    elem: '#table'
    ,height: 'full-200'
    ,url: '/admin/invest/rateList/' //数据接口
    ,limit:20
    ,page: true //开启分页
    ,id:'reload'
    ,cols: [[ //表头
        {field:'id', title: '用户ID', width: 100}
        ,{field:'name', title: '智能云', width: 150}
        ,{field:'rate', title: '比例', width: 150}
        ,{field:'date', title: '时间', width: 200}
    ]]
  });
  // 搜索
  var $ = layui.$, active = {
        reload: function(){
            table.reload('reload', {
                where: {
                    config_id: $('#config_id').val(),
                }
            });
        }
    };
    $('.demoTable .layui-btn').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';

  });

  //日期
  laydate.render({
    elem: '#start_time'
  });
  laydate.render({
    elem: '#end_time'
  });
});
function add(){
  layer.open({
        type: 2 ,
        title: '添加',   //标题
        area: ['400px', '400px'],   //宽高
        shade: 0.4,   //遮罩透明度
        content: '/admin/invest/addRate'
        // end:function(){
        //   $(".layui-laypage-btn")[0].click();
        // }
        });
}
</script>
{/block}
